import { post, get, put } from '../utils/axiosFunc'
import { Commit } from 'vuex'

export const postFn = async (url: string, postdata: any = {}, mutationsName: string, commit: Commit) => {
  const result = await post(url, postdata)
  commit(mutationsName, result)
  return result
}

export const getFn = async (url: string, mutationsName: string, commit: Commit, getdata: any = {}) => {
  const result = await get(url, getdata)
  commit(mutationsName, result)
  return result
}

export const putFn = async (url: string, putData: any = {}, mutationsName: string, commit: Commit) => {
  const result = await put(url, putData)
  commit(mutationsName, result)
  return result
}